<!doctype html>
<html lang="zh-CH">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
	<title>木投网--个人中心--发布采购单</title>
	<link rel="stylesheet" href="/resource/css/mt_index.css">
	<link rel="stylesheet" href="/resource/css/mt_user.css">
	<link rel="stylesheet" href="/resource/css/mt_showBo.css">
</head>
<body>
@include("common.shop_user_head")
		<div class="user-cont left">
			<div class="user-title">发布采购单</div>
			<div class="resource">
				<!-- 发布采购单 -->
				<div class="popup-order">
					<div class="order-info">
						温馨提示：发布成功后，1个工作日内审核完毕，信息越详细，越容易为您匹配到资源。
					</div>
					<form action="" class="form">
						<div class="form-group">
							<label for="">商品标题：</label>
							<input type="text" id="title" class="form-control" placeholder="如：求购金丝楠木">
							<i class="i-red">*</i>
							<span></span>
						</div>
						<div class="form-group">
							<label for="">规格：</label>
							<input type="text" id="spec" class="form-control" placeholder="请填写规格">
							<i class="i-red">*</i>
							<span></span>
						</div>
						<div class="form-group form-two">
							<label for="">数量：</label>
							<input type="text" id="num" class="form-control" placeholder="采购数量">
							<i class="i-red">*</i>
							<span></span>
						</div>
						<div class="form-group form-two">
							<label for="">单位：</label>
							<select id="unit"  class="form-control">
								<option value="立方米">立方米</option>
								<option value="平方米">平方米</option>
								<option value="吨">吨</option>
								<option value="张">张</option>
								<!--<option value="公斤">公斤</option>
								<option value="千克">千克</option>
								<option value="套">套</option>
								<option value="件">件</option>
								<option value="组">组</option>
								<option value="把">把</option>
								<option value="对">对</option>-->

							</select>
							<i class="i-red">*</i>
							<span></span>
						</div>
						<div class="form-group form-two clear">
							<label for="">价格：</label>
							<input type="text" id="price" class="form-control" placeholder="请填写数字或面议">
							<i class="i-red">*</i>
							<span></span>
						</div>
						<div class="form-group form-two clear">
							<label for="">交货地：</label>
							<select id="place" class="form-control">
								<option value="北京">北京</option>
								<option value="上海">上海</option>
								<option value="天津">天津</option>
								<option value="重庆">重庆</option>
								<option value="广东">广东</option>
								<option value="四川">四川</option>
								<option value="浙江">浙江</option>
								<option value="贵州">贵州</option>
								<option value="辽宁">辽宁</option>
								<option value="江苏">江苏</option>
								<option value="福建">福建</option>
								<option value="河北">河北</option>
								<option value="河南">河南</option>
								<option value="吉林">吉林</option>
								<option value="黑龙江">黑龙江</option>
								<option value="山东">山东</option>
								<option value="安徽">安徽</option>
								<option value="广西">广西</option>
								<option value="海南">海南</option>
								<option value="内蒙古">内蒙古</option>
								<option value="山西">山西</option>
								<option value="宁夏">宁夏</option>
								<option value="甘肃">甘肃</option>
								<option value="陕西">陕西</option>
								<option value="青海">青海</option>
								<option value="湖北">湖北</option>
								<option value="湖南">湖南</option>
								<option value="江西">江西</option>
								<option value="云南">云南</option>
								<option value="新疆">新疆</option>
								<option value="香港">香港</option>
								<option value="澳门">澳门</option>
							</select>
							<input type="text" id="address" class="form-control form-address" placeholder="详细地址">
							<i class="i-red">*</i>
							<span></span>
						</div>
						<div class="form-group clear">
							<label for="">备注：</label>
							<textarea name="" id="sign" class="form-control"></textarea>
						</div>
						<div class="form-hr"></div>
						<div class="form-group form-two">
							<label for="">联系人：</label>
							<input type="text" id="contacts" class="form-control" placeholder="" value="{{$user->user_name}}">
							<i class="i-red">*</i>
							<span></span>
						</div>
						<div class="form-group form-two">
							<label for="">电话：</label>
							<input type="text" id="tell" class="form-control" placeholder=""  value="{{$user->mobile}}">
							<i class="i-red">*</i>
							<span></span>
						</div>
						<div class="form-group clear">
							<label for="">公司：</label>
							<input type="text" id="company" class="form-control" placeholder=""  value="{{$user->corporation}}">
							<i class="i-red">*</i>
							<span></span>
						</div>
						<button type="button" class="btn-immed">立即发布</button>
					</form>
				</div>
			</div>
		</div>
		@include("common.shop_user_foot")
<script src="/resource/js/jquery-1.11.3.min.js"></script>
<script src="/resource/js/mt_index.js"></script>
<script src="/resource/js/mt_showBo.js"></script>  <!-- 提示信息 -->
<script>

	$('.form-control').blur(function(){
		if($(this).val()==''){
			$(this).siblings('span').show().html('不能为空');
		}else{
			$(this).siblings('span').hide();
		}
	});
	$('.btn-immed').click(function(){
		var title = $('#title').val();
		var spec = $('#spec').val();
		var num = $('#num').val();
		var unit = $('#unit').val();
		var place = $('#place').val();
		var price = $('#price').val();
		var address = $('#address').val();
		var sign = $('#sign').val();
		var contacts = $('#contacts').val();
		var tell = $('#tell').val();
		var company = $('#company').val();
		if(title==''){
			$('#title').siblings('span').show().html('不能为空');
			return false;
		}else{
			$('#title').siblings('span').hide();
		}
		if(spec==''){
			$('#spec').siblings('span').show().html('不能为空');
			return false;
		}else{
			$('#spec').siblings('span').hide();
		}
		if(num==''){
			$('#num').siblings('span').show().html('不能为空');
			return false;
		}else{
			$('#num').siblings('span').hide();
		}
		if(unit==''){
			$('#unit').siblings('span').show().html('不能为空');
			return false;
		}else{
			$('#unit').siblings('span').hide();
		}
		if(place==''){
			$('#place').siblings('span').show().html('不能为空');
			return false;
		}else{
			$('#place').siblings('span').hide();
		}
		if(price==''){
			$('#price').siblings('span').show().html('不能为空');
			return false;
		}else{
			$('#price').siblings('span').hide();
		}
		if(address==''){
			$('#address').siblings('span').show().html('不能为空');
			return false;
		}else{
			$('#address').siblings('span').hide();
		}
		if(contacts==''){
			$('#contacts').siblings('span').show().html('不能为空');
			return false;
		}else{
			$('#contacts').siblings('span').hide();
		}
		if(tell==''){
			$('#tell').siblings('span').show().html('不能为空');
			return false;
		}else{
			$('#tell').siblings('span').hide();
		}
		if(company==''){
			$('#company').siblings('span').show().html('不能为空');
			return false;
		}else{
			$('#company').siblings('span').hide();
		}
		$('.form-group span').hide();
		$.ajax({
			url : '/add_purchase',
			type : "POST",
			data : {title:title,spec:spec,num:num,unit:unit,place:place,price:price,address:address,sign:sign,contacts:contacts,tell:tell,company:company},
			dataType : "json",
			cache:"false",
			timeout:30000,
			success : function(json) {
				if(json.code >= 1){
					Showbo.Msg.alert('<img src="/resource/img/popup_success.png" alt=""><br/>您的采购需求已经成功提交，请等待交易员与您联系<br/><br/>');
				}
			}
		});
	});
	//发布采购单
//	$('.btn-immed').click(function(){
//		Showbo.Msg.alert('<img src="/resource/img/popup_success_.png" alt="">我们会尽快为您审核，并且帮您找到更合适的资源<br/><br/>');
//		$('#dvMsgBtns input.btn').css('width','120px');
//	});
</script>
</body>
</html>